#ifndef _NETWORK_INCLUDE_VSOMEIPCLIENT_H
#define _NETWORK_INCLUDE_VSOMEIPCLIENT_H

#include <vsomeip/vsomeip.hpp>
#include <chrono>
#include <condition_variable>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <thread>
#include <memory>

class VsomeipClient
{
public:
    VsomeipClient();

    static VsomeipClient& instance();

    void startup();
    void teardown();

private:
    bool init();
    void start();
    void stop();

    void on_state(vsomeip::state_type_e _state);
    void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available);

    void printEvent(const std::shared_ptr<vsomeip::message> &event);
    void on_image(const std::shared_ptr<vsomeip::message> &event);
    void on_face_detect(const std::shared_ptr<vsomeip::message> &event);
    void on_dms_keypoint(const std::shared_ptr<vsomeip::message> &event);

    std::shared_ptr< vsomeip::application > app_;
    std::thread                             itsThread;

    static constexpr auto DMS_SERVICE_ID         = 0x0402;
    static constexpr auto DMS_INSTANCE_ID        = 0x0001;
    static constexpr auto DMS_METHOD_ID          = 0x8001;
    static constexpr auto DMS_H264_IMG_EVENT_ID  = 0x1101;
    static constexpr auto DMS_DETECT_BBOX        = 0x1102;
    static constexpr auto DMS_KEYPOINT           = 0x1103;
    static constexpr auto DMS_EVENTGROUP_ID      = 0x1101;
};


#endif
